<?php

class Workset_Db_Table_Select extends Zend_Db_Table_Select {

    const SQL_CALC_FOUND_ROWS = 'SQL_CALC_FOUND_ROWS';

    const FOUND_ROWS = 'FOUND_ROWS()';

    protected $_statements = array();

    function assemble()
    {
        $sql = parent::assemble();

        if (!empty($this->_statements)) {
            if (is_array($this->_statements)) {
                $st = implode(" ", $this->_statements);
            } else {
                $st = $this->_statements;
            }

            $sql = str_replace(self::SQL_SELECT, self::SQL_SELECT.' '.$st, $sql);

        }

        return $sql;
    }

    function setStatement($name) {
        $this->_statements[] = $name;
    }

}

?>